<template>
  <div class="tabbaritem" @click="btnClick">
    <div v-if="!finallyShow"><slot name="pic"></slot></div>
    <div v-else><slot name="activePic"></slot></div>
    <div :style="finallyTxt"><slot name="txt"></slot></div>
  </div>
</template>
<script>
export default {
  name: 'tabbaritem',
  data: () => ({
    // isShow: true
  }),
  props: {
    path: String,
    setColor: {
      type: String,
      default: 'red'
    }
  },
  computed: {
    finallyShow() {
      return this.$route.path.indexOf(this.path) != -1
    },
    finallyTxt() {
      return this.$route.path == this.path ? { color: this.setColor } : {}
    }
  },
  methods: {
    btnClick() {
      this.$router.push(this.path)
    }
  }
}
</script>
<style scoped>
.tabbaritem {
  flex: 1;
  height: 49px;
}

.tabbaritem img {
  margin-top: 2px;
  margin-bottom: 2px;
  width: 29px;
  height: 29px;
  vertical-align: middle;
}
</style>